package oa.service.impl;

import java.util.Collection;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import oa.dao.DepartmentDao;
import oa.domain.page.PageBean;
import oa.domain.system.Department;
import oa.service.DepartmentService;
import oa.util.HQLHelper;

@Service("departmentService")
public class DepartmentServiceImpl implements DepartmentService{

	@Resource(name="departmentDao")
	private DepartmentDao departmentDao;
	@Override
	public Collection<Department> getAllDeaprtment() {
		// TODO Auto-generated method stub
		return this.departmentDao.getAllEntry();
	}
	
	@Transactional(readOnly=false)
	public void saveDepartment(Department department) {
		// TODO Auto-generated method stub
		this.departmentDao.saveEntity(department);
	}

	@Override
	public Department getDepartmentById(Long id) {
		// TODO Auto-generated method stub
		return this.departmentDao.getEntryById(id);
	}

	@Transactional(readOnly=false)
	public void upateDepartment(Department department) {
		// TODO Auto-generated method stub
		this.departmentDao.updateEntry(department);
	}

	@Transactional(readOnly=false)
	public void deleteDepartment(Long id) {
		// TODO Auto-generated method stub
		this.departmentDao.deleteEntry(id);
	}

	@Override
	public PageBean getPageBean(HQLHelper hh, int currentPage) {
		// TODO Auto-generated method stub
		return this.departmentDao.getPageBean(hh, currentPage);
	}
	
	

}
